package com.complaint.rest.proxy;

import com.complaint.rest.model.Complaint;
import com.complaint.rest.user.dto.ComplaintForm;

/**
 * Created by Alex
 */
public class Proxy {
    public static Complaint createFromComplaintForm(ComplaintForm complaintForm) {
        Complaint complaint = new Complaint();
        complaint.setId(complaintForm.getId());
        complaint.setAuthorId(complaintForm.getAuthorId());
        complaint.setSubject(complaintForm.getSubject());
        complaint.setDescription(complaintForm.getDescription());
        complaint.setPublishDate(complaintForm.getPublishDate());
        return complaint;
    }

    public static ComplaintForm createFromComplaint(Complaint complaint) {
        ComplaintForm complaintForm = new ComplaintForm();
        complaintForm.setId(complaint.getId());
        complaintForm.setAuthorId(complaint.getAuthorId());
        complaintForm.setSubject(complaint.getSubject());
        complaintForm.setDescription(complaint.getDescription());
        complaintForm.setPublishDate(complaint.getPublishDate());
        return complaintForm;
    }
}
